<h1>HORARIO POR BOX</h1>

<form action="<?php echo url_for('horario3/listarxbox'); ?>" method="post">
    <table>
    <tbody>
        <?php echo $formulario; ?>
    </tbody>
    </table>
<input type="submit" value="VER HORARIO" name="filtrar"/>
</form>
<br>

<?php $horario = array(); ?>
<?php $dia = array(); ?>
<?php $data = array(); ?>

<?php //MATRIZ HORARIO VACIO ?>
<?php foreach ($gestdent_hora_list as $gestdent_hora): ?>
    <?php foreach ($gestdent_dia_list as $gestdent_dia): ?>
        <?php $data["Doctor"] = ""; ?>
        <?php $data["Color"] = ""; ?>
        <?php //$data["Rows"] = 1; ?>
        <?php $dia[$gestdent_dia->getId()] = $data; ?>
        <?php $horario[$gestdent_hora->getId()] = $dia; ?>
    <?php endforeach; ?>
<?php endforeach; ?>


<?php //LLENAMOS MATRIZ CON HORARIO ?>
<?php foreach ($gestdent_horario3_list as $gestdent_horario3): ?>

    <?php $detalle_list = $gestdent_horario3->getDetalle() ?>
    <?php foreach ($detalle_list as $detalle): ?>
        <?php $horario[$detalle->getHoraId()][$gestdent_horario3->getDiaId()]["Doctor"] .= $gestdent_horario3->getGestdentPersonal()->getNombres()." ".$gestdent_horario3->getGestdentPersonal()->getApellidoPaterno()."<br>" ?>
        
    <?php endforeach; ?>

<?php endforeach; ?>


<table>
    <thead
        <th><?php echo "Hora/Día" ?></th>
        <?php foreach ($gestdent_dia_list as $gestdent_dia): ?>
        <th><?php echo $gestdent_dia->getDescripcion() ?></th>
        <?php endforeach; ?>
    </thead>

    <tbody>
        <?php foreach ($gestdent_hora_list as $gestdent_hora): ?>

        <tr>
            <td>
                <?php echo $gestdent_hora->getDescripcion() ?>
            </td>

            <?php foreach ($gestdent_dia_list as $gestdent_dia): ?>

                <td style="background-color:<?php echo $horario[$gestdent_hora->getId()][$gestdent_dia->getId()]["Color"]; ?>;">
                    <?php echo $horario[$gestdent_hora->getId()][$gestdent_dia->getId()]["Doctor"]; ?>
                    <a href="<?php echo url_for('horario3/new') ?>">Agregar</a>
                </td>


            <?php endforeach; ?>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>


<?php

$mifecha = time();
//echo date('w',$mifecha);

?>

<pre><?php //print_r ($gestdent_horario3_list); ?></pre>